require 'active_record'

class Persona < ActiveRecord::Base
  #Asociaciones
  belongs_to :direccion
  belongs_to :sexo
  belongs_to :estado_civil
  has_and_belongs_to_many :empresas
  has_and_belongs_to_many :tipo_promociones
  has_many :garantia_garantes, :class_name => "Garantia", :foreign_key => "beneficiario_id"
  has_many :garantia_beneficiarios, :class_name => "Garantia", :foreign_key => "garante_id"  
  has_one :nucleo_familiar_responsable, :class_name => "NucleoFamiliar", :foreign_key => "persona_responsable_id"
  has_one :nucleo_familiar_integrante, :class_name => "NucleoFamiliar", :foreign_key => "persona_integrante_id"

  #Validaciones
  #validates_presence_of :cedula, :nombres, :apellidos, :fecha_nacimiento, :telefono,:direccion, :sexo, :estado_civil
  #validates_uniqueness_of :cedula
end
